package com.netsmart.util;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import sun.misc.BASE64Encoder;

public class MD5Util {

	public static String backPass(String ostr) {

		String nstr = null;
		if (ostr != null) {
			try {
				MessageDigest md5 = MessageDigest.getInstance("MD5");
				BASE64Encoder base = new BASE64Encoder();
				nstr = base.encode(md5.digest(ostr.getBytes("UTF-8")));
				System.out.println(nstr);
			} catch (NoSuchAlgorithmException e) {
				e.printStackTrace();
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			}
		}
		return nstr;
	}

	public static void main(String[] args) {
		String str = "12345678909";
//		System.out.println(str.substring(6));
		backPass(str);

	}

}
